package com.s2m;

import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;

import jxl.Workbook;
import jxl.write.Label;
import jxl.write.WritableSheet;
import jxl.write.WritableWorkbook;
import jxl.write.WriteException;
import jxl.write.biff.RowsExceededException;

public class ExcelTest {
	public static void main(String[] args) throws RowsExceededException, WriteException, IOException {
//	ByteArrayOutputStream out = new ByteArrayOutputStream();
		WritableWorkbook mWorkBook = Workbook.createWorkbook(new File("Test.xls"));
		WritableSheet mSheet = mWorkBook.createSheet("杨林测试", 0);
		List<List<String>> t=new ArrayList<>();
		List<String> t1=new ArrayList<>();
		t1.add("test11");
		t1.add("test12");
		List<String> t2=new ArrayList<>();
		t2.add("test21");
		t2.add("test22");
		
		t.add(t1);
		t.add(t2);
		for (int i = 0,s1 = t.size(); i < s1; i++) {
			List<String> ls =t.get(i);
			for (int j = 0,s2 = ls.size(); j < s2; j++) {
				mSheet.addCell(new Label(j, i, ls.get(j)));
			}
		}
		mWorkBook.write();
		mWorkBook.close();
	}
}
